home *** CD-ROM | disk | FTP | other *** search
/ Netscape Plug-Ins Developer's Kit / Netscape_Plug-Ins_Developers_Kit.iso / CGIPERL / MACPERL / MSRCE418.HQX / Perl Source ƒ / MacPerl / MPGlobals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-25  |  7.1 KB  |  360 lines

  1. /*********************************************************************
  2. Project    :    MacPerl                -    Real Perl Application
  3. File        :    MPGlobals.h    -
  4. Author    :    Matthias Neeracher
  5.  
  6. A lot of this code is borrowed from 7Edit written by
  7. Apple Developer Support UK
  8.  
  9. Language    :    MPW C
  10.  
  11. $Log: MPGlobals.h,v $
  12. Revision 1.2  1994/05/04  02:51:46  neeri
  13. Inline Input.
  14.  
  15. Revision 1.1  1994/02/27  23:03:27  neeri
  16. Initial revision
  17.  
  18. Revision 0.5  1993/12/12  00:00:00  neeri
  19. PerlPrefs, SacrificalGoat
  20.  
  21. Revision 0.4  1993/08/17  00:00:00  neeri
  22. LibraryPaths
  23.  
  24. Revision 0.3  1993/08/05  00:00:00  neeri
  25. Small icons
  26.  
  27. Revision 0.2  1993/05/29  00:00:00  neeri
  28. Support console windows
  29.  
  30. Revision 0.1  1993/05/29  00:00:00  neeri
  31. Compiles correctly
  32.  
  33. *********************************************************************/
  34.  
  35. #ifndef __MPGLOBALS__
  36. #define __MPGLOBALS__
  37.  
  38. #include <Types.h>
  39. #include <QuickDraw.h>
  40. #include <Menus.h>
  41. #include <Editions.h>
  42. #include <Printing.h>
  43. #include <AppleEvents.h>
  44. #include <TextServices.h>
  45. #include <TSMTE.h>
  46. #include <setjmp.h>
  47.  
  48. #include <MacPerl.h>
  49.  
  50. #include "MPRsrc.h"
  51.  
  52. #ifndef EXTERN
  53. #define EXTERN extern 
  54. #define INIT(x)
  55. #endif
  56.  
  57. #define  PerlWindowKind    5146
  58.  
  59. #define    LibraryPaths    128
  60.  
  61. /*
  62.     Items in Apple Menu
  63. */
  64.  
  65. #define  aboutItem  1
  66.  
  67. /*
  68.     Items in File Menu
  69. */
  70.  
  71. #define  fmNew                    1
  72. #define  fmOpen                2
  73. #define  fmClose                4
  74. #define  fmSave                5
  75. #define  fmSaveAs                6
  76. #define  fmRevert                7
  77. #define  fmPageSetUp            9
  78. #define  fmPrint                10
  79. #define  fmQuit                12
  80.  
  81. /*
  82.     Items in Edit Menu
  83. */
  84. #define  undoCommand            1
  85. #define  cutCommand             3
  86. #define  copyCommand         4
  87. #define  pasteCommand         5
  88. #define  clearCommand         6
  89. #define  selectAllCommand     7
  90.  
  91. #ifndef RUNTIME
  92. #define    emJumpTo                9
  93. #define    emFormat                11
  94.  
  95. #define  cPublisher           13
  96. #define  cSubscriber          14
  97. #define  cOptions             15
  98. #define  cBorders             16
  99.  
  100. #define    emPreferences        18
  101.  
  102. #else
  103.  
  104. #define    emFormat                9
  105. #define    emPreferences        11
  106.  
  107. #endif
  108.  
  109. /*
  110.     Items in Perl Menu
  111. */
  112. #define    pmRun                1
  113. #define    pmRunFront        2
  114.  
  115. #ifndef RUNTIME
  116.  
  117. /*
  118.     Item in Help Menu
  119. */
  120. #define    hmExplain        5
  121.  
  122. #endif
  123.  
  124. /*
  125.     Entry of Menu in myMenus
  126. */
  127. #define  appleM             0
  128. #define  fileM              1
  129. #define  editM              2
  130. #define    windowM            3
  131. #define    perlM                4
  132.  
  133. #ifndef RUNTIME
  134.  
  135. #define    helpM                5
  136. #define  kLastMenu        5
  137.  
  138. #else
  139.  
  140. #define kLastMenu            4
  141.  
  142. #endif
  143.  
  144. /*
  145.     Save Changes Dialog Items
  146. */
  147.  
  148. #define  aaSave              1
  149. #define  aaDiscard          2
  150. #define  aaCancel         3
  151.  
  152. #define  kOSEvent                       app4Evt    /*event used by MultiFinder*/
  153. #define  kSuspendResumeMessage        1        /*high byte of suspend/resume event message*/
  154. #define  kResumeMask                         1        /*bit of message field for resume vs. suspend*/
  155. #define  kMouseMovedMessage              0xFA    /*high byte of mouse-moved event message*/
  156. #define  kNoEvents                         0        /*no events mask*/
  157.  
  158. /* How much memory to set aside for emergencies */
  159.  
  160. #define SACRIFICE        32768
  161.  
  162. /* File too bulky for TextEdit */
  163.  
  164. #define elvisErr        666
  165.  
  166. /*
  167.     this is a section record to hold the information about
  168.     the publishers and subscribers in this document
  169. */
  170.  
  171. struct SectRec {
  172.     SectionHandle   fSectHandle;
  173.     short           fSectionID;
  174.     RgnHandle       fBorderRgn; /*handle to the outside border*/
  175.     Rect            fInnerBounds;
  176.     short           fStart;     /*fStart and fEnd are both specific to a*/
  177.     short           fEnd;       /*text handling application- start and end of text selection*/
  178.     struct SectRec  **fNextSection;
  179.     FSSpec          fFSSpec;
  180.     short           fCount;
  181.     Handle          fTextHandle;
  182.     Boolean         fChanged; /*has the section been changed*/
  183.     struct DocRec   *fDocument;
  184. };
  185.  
  186. typedef struct SectRec SectRec;
  187. typedef SectRec *SectPtr, **SectHandle;
  188.  
  189. typedef enum {
  190.     kDocumentWindow,
  191.     kWorksheetWindow,
  192.     kConsoleWindow
  193. } WindowKind;
  194.  
  195. typedef struct RegularDoc {
  196.     Boolean          showBorders;
  197.     Boolean        everSaved;
  198.     Boolean            everLoaded;
  199.     SectHandle       firstSection; /*the first section in the list*/
  200.     SectHandle       lastSection;  /*the last section*/
  201.     short          numSections;
  202.     short          lastID;      /*the last sectionID*/
  203.     FSSpec             origFSSpec;
  204. } RegularDoc;
  205.  
  206. struct DocRec;
  207.  
  208. typedef struct ConsoleDoc {
  209.     struct DocRec *next;
  210.     Ptr                cookie;
  211.     short                memory;
  212.     short                fence;
  213.     Boolean            selected;
  214. } ConsoleDoc;
  215.  
  216. enum {
  217.     stateConsole = 0x0001,
  218.     stateDocument= 0x0002,
  219.     stateRdWr    = 0x0010,
  220.     stateRdOnly  = 0x0020,
  221.     stateBlocked = 0x0030
  222. };
  223.  
  224. enum {
  225.     kPreferenceDoc = 'pref',
  226.     kPlainTextDoc    = 'TEXT',
  227.     kScriptDoc        = 'SCPT',
  228.     kRuntime6Doc    = 'MrP6',
  229.     kRuntime7Doc    = 'MrP7',
  230.     kOldRuntime6Doc= 'OlP6',
  231.     kUnknownDoc        = '\?\?\?\?'
  232. };
  233.  
  234. typedef OSType    DocType;
  235.  
  236. struct DocRec {
  237.     TEHandle       theText;
  238.     ControlHandle  vScrollBar;
  239.     ControlHandle  hScrollBar;
  240.     WindowPtr      theWindow;
  241.     short          refNum;
  242.     short                lastState;
  243.     Str255         theFileName;
  244.     FSSpec           theFSSpec;
  245.     THPrint        thePrintSetup;
  246.     Rect           pageSize;    /*From thePrintSetUp^^.prInfo.rPage but 0 offset*/
  247.     Boolean        dirty;
  248.     Boolean            inDataFork;
  249.     DocType            type;
  250.     WindowKind        kind;
  251. #ifndef RUNTIME
  252.     TSMTERecHandle    tsmTERecHandle;
  253.     TSMDocumentID    tsmDoc;
  254. #endif
  255.     union {
  256.         RegularDoc    reg;
  257.         ConsoleDoc    cons;
  258.     } u;
  259. };
  260.  
  261. typedef struct DocRec DocRec;
  262. typedef DocRec *DPtr;
  263.  
  264. #if defined(powerc) || defined (__powerc)
  265. #pragma options align=mac68k
  266. #endif
  267.  
  268. struct HeaderRec {
  269.     Rect        theRect;
  270.     Str255   theFont;
  271.     short        theSize;
  272.     short    theLength;
  273.     short    numSections;
  274.     short    lastID;
  275. };
  276.  
  277. typedef struct HeaderRec HeaderRec;
  278.  
  279. #if defined(powerc) || defined (__powerc)
  280. #pragma options align=reset
  281. #endif
  282.  
  283. typedef HeaderRec *HPtr, **HHandle;
  284.  
  285. struct DocFormat {
  286.     short        font;
  287.     short        size;
  288. };
  289.  
  290. typedef struct DocFormat DocFormat;
  291.  
  292. #if defined(powerc) || defined (__powerc)
  293. #pragma options align=mac68k
  294. #endif
  295.  
  296. struct PerlPrefs    {
  297.     short        version;
  298. #define PerlPrefVersion411    0
  299. #define PerlPrefVersion413    1
  300.     Boolean    runFinderOpens;
  301.     Boolean    checkType;
  302.     Boolean    inlineInput;
  303. };
  304.  
  305. typedef struct PerlPrefs PerlPrefs;
  306.  
  307. #if defined(powerc) || defined (__powerc)
  308. #pragma options align=reset
  309. #endif
  310.  
  311. EXTERN short              gWCount;
  312. EXTERN short              gNewDocCount;
  313. EXTERN MenuHandle         myMenus[kLastMenu+1];
  314. EXTERN short              gFontMItem;
  315. EXTERN Boolean            gQuitting;
  316. EXTERN Cursor             editCursor;
  317. EXTERN Cursor             waitCursor;
  318. EXTERN Boolean            gInBackground;
  319. EXTERN Boolean                gRunningPerl;
  320. EXTERN Boolean                gRemoteControl;
  321. EXTERN DPtr                    gConsoleList;
  322. EXTERN short                gPrefsFile;
  323. EXTERN short                gScriptFile;
  324. EXTERN WindowPtr            gActiveWindow;
  325. MP_EXT short                gAppFile;
  326. MP_EXT short                gAppVol;
  327. MP_EXT long                    gAppDir;
  328. EXTERN DocFormat            gFormat;
  329. EXTERN Handle                gRuntimeScript;
  330. EXTERN Handle                gPseudoFile;
  331. EXTERN AppleEvent ***    gWaitingScripts;
  332. EXTERN DPtr                    gGotEof;
  333. EXTERN PerlPrefs            gPerlPrefs;
  334. MP_EXT Handle                gSacrificialGoat;
  335. EXTERN jmp_buf                gExitPerl;
  336. EXTERN AppleEvent            gDelayedScript;
  337. EXTERN short                gCompletedScripts;
  338.  
  339. #ifndef RUNTIME
  340.  
  341. EXTERN long         gSavedFontForce;
  342.  
  343. #endif
  344.  
  345.   /*now for the environment variables set up by Gestalt*/
  346.  
  347. EXTERN Boolean    gAppleEventsImplemented;
  348.  
  349. #ifndef RUNTIME
  350.  
  351. EXTERN Boolean    gAliasManagerImplemented;
  352. EXTERN Boolean    gEditionManagerImplemented;
  353. EXTERN Boolean    gOutlineFontsImplemented;
  354. EXTERN Boolean    gRecordingImplemented;
  355. EXTERN Boolean        gTextServicesImplemented;
  356. EXTERN Boolean        gTSMTEImplemented;
  357.  
  358. #endif
  359.  
  360. #endif